<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/13
 * Time: 9:21
 */

namespace app\lib\exception;


use Throwable;

class ParameterException extends BaseException
{
    //HTTP 状态码 404 200
    public $code = 400;

    //错误具体信息
    public $msg = '参数错误';

    //自定义错误码
    public $errorCode = 10000;

    public function __construct(Array $param)
    {
        if (!is_array($param)){
            return ;
        }

        if (array_key_exists('code',$param)) {
            $this->code = $param['code'];
        }
        if (array_key_exists('msg',$param)){
            $this->msg = $param['msg'];
        }
        if (array_key_exists('errorCode',$param)){
            $this->code = $param['errorCode'];
        }
    }
}